<?php
/**
 * wechat php test
 */
//define your token
@header("Content-type: text/html; charset=utf-8");

error_reporting(E_WARNING);

define("TOKEN", "luge0126");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->responseMsg();
//$wechatObj->createMenu();
// $wechatObj->getPresent();
class wechatCallbackapiTest
{
    public $topid=34419;
    public $welcomeMsg = '[玫瑰]欢迎关注顶上集成吊顶，集成吊顶第一品牌。;
    1、 顶上315特别活动，刮刮乐大抽奖,点击导航[微互动][每日抽奖],即刻参与。
    2、语音回复地区+天气 如"杭州天气"
    3、语音回复地区+专卖店 如"浙江专卖店或宁波专卖店",
    4、语音回复省份+活动 如"江苏活动"';
    public $access_token = "V6aZ5MFtsI6F4ARBDRJgMM7Zei4J1rsk6GJwKS4Tn8ddTaR6X2iQJDnrB8niLTaNjASyHZb4UuWtKTUi3z248SlZ9Owri4cAMszkdITn7Ta8rmUPks_Berg65bN9uHblRrvTN0BG4Vd_zoqh4tpzlQ";
    public $db;
    public $help = '帮助提示
    1、顶上315特别活动，刮刮乐大抽奖,点击导航[微互动][每日抽奖],即刻参与。
    2、语音回复地区+天气 如"杭州天气"
    3、语音回复地区+专卖店 如"浙江专卖店或宁波专卖店",
    4、语音回复省份+活动 如"江苏活动"';
    public $presentnum;
    public $openid;
    public $myUser;
    public $liwu = "[礼物]谢谢参与，活动已经结束";
    public function __construct()
    {
        require '../lib/mysql.php';
        
        $this->db = new DB();
    }
    
    public function presentNum()
    {
        $sql = "SELECT * FROM w_wx_config WHERE id=1";
        $query = $this->db->query($sql);
        $rs = $this->db->fetch_array($query);
        
        return $rs['value'];
    
     //  var_dump($rs);
    

    }
    /**
     * 
     * 
     */
    public function getPresent()
    {
        $gl = rand(1, 10);
        $num = $this->presentNum();
        $this->presentnum = $num;
        
        if ($num < 1) {
            return "[玫瑰]礼物已经送完，感谢你的参与!";
        }
        
        //   $user = $this->getUserInfo($this->openid);
        // $user['sex'] = $user['sex'] == 1 ? "先生" : "女士";
        $time = time();
        $user = $this->myUser;
        $sql3 = "UPDATE w_wx_user SET `num`=`num`-1 WHERE username='$user[username]'";
        $this->db->query($sql3);
        if ($gl <= 3) {
            $sql2 = "UPDATE w_wx_config SET `value`=`value`-1 WHERE id=1";
            $this->db->query($sql2);
            $this->setVoteList($user['username'], $user['sex'], $user['address'], null, "温情保暖袜", $time);
            $this->presentnum = $num - 1;
            return $this->liwu;
        } else {
            $this->setVoteList($user['username'], $user['sex'], $user['address'], null, null, $time);
            
            return $this->mingyan();
        }
    
    }
    
    /**
     * 设置队列
     * Enter description here ...
     */
    public function setVoteList($username, $sex, $city, $mobile_phone, $remark, $time)
    {
        $sql = "INSERT INTO w_wx_list (username,sex,city,mobile_phone,remark,add_time) VALUES('$username','$sex','$city','$mobile_phone','$remark',$time)";
        $this->db->query($sql);
    }
    
    public function guli()
    {
        echo "剩余奖品" . self::$present;
        echo $this->getPresent();
    }
    
    public function valid()
    {
        $echoStr = $_GET["echostr"];
        //valid signature , option
        if ($this->checkSignature()) {
            echo $echoStr;
            exit();
        }
    }
    
    //回馈输出内容
    public function responseMsg()
    {
        //如果是第一次订阅
        //get post data, May be due to the different environments
        $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
        //extract post data
        if (! empty($postStr)) {
            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
            $fromUsername = $postObj->FromUserName; //openId 来源
            $this->openid = $fromUsername;
            $toUsername = $postObj->ToUserName;
            $keyword = trim($postObj->Content);
            $msgType = trim($postObj->MsgType); //读取当前消息类型
            $event = trim($postObj->Event); //读取当前事件名
            $time = time();
            $textTpl = "<xml>
							<ToUserName><![CDATA[%s]]></ToUserName>
							<FromUserName><![CDATA[%s]]></FromUserName>
							<CreateTime>%s</CreateTime>
							<MsgType><![CDATA[%s]]></MsgType>
							<Content><![CDATA[%s]]></Content>
							<FuncFlag>0</FuncFlag>
							</xml>";
            
            if ($msgType == "event") { //获取事件类型
                

                if ($event == 'CLICK') {
                    $keyword = trim($postObj->EventKey);
                
                }
                
                if ($event == 'subscribe') {
                    $contentResText = $this->welcomeMsg; //初次关注的时候推送欢迎消息
                    $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", $contentResText);
                    echo $resultStr;
                    exit();
                }
            }
            //检查用户信息
            $user = $this->getUserInfo($fromUsername);
            $sex = $user['sex'] == 1 ? "先生" : "女士";
            $this->myUser = $this->setVoteUser($user['nickname'], 3, $sex, $user['city'], $fromUsername, $time);
            if ($msgType == "voice") {
                $contentResText = trim($postObj->Recognition);
                if (strpos($contentResText, "天气") > 0) {
                    $city = str_replace("天气", "", $contentResText);
                    $contentStr = $this->getWeather($city);
                    $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", $contentStr);
                    echo $resultStr;
                    exit();
                } else if ($contentResText == "鼎尚中国好吊顶" || $contentResText == "顶上中国好吊顶") {
                    //检查用户抽奖次数
                    if ($this->myUser['num'] < 1) {
                        $contentStr = "抱歉,今天的抽奖次数已经用完，明天再来吧！祝你好运[玫瑰]";
                    } else {
                        $contentStr = $this->getPresent();
                        $contentStr = $contentStr . " 剩余奖品数:" . $this->presentnum . " 剩余抽奖次数:" . ($this->myUser['num'] - 1);
                    }
                    $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", $contentStr);
                    echo $resultStr;
                    exit();
                } elseif (strpos($contentResText, "专卖店") > 0) {
                    $city = str_replace("专卖店", "", $contentResText);
                    $citys = $this->getShop($city, "RS");
                    $citynum = $this->getShop($city, "NUM");
                    if ($citynum < 1) {
                        $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", "无法为你找到" . $city . "地区专卖店么,建议如浙江专卖店,杭州专卖店,想加盟或了解更多，请致电0573-83253333，陈经理");
                        echo $resultStr;
                        exit();
                    
                    }
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //获取最新的新闻资讯
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", $citynum);
                    $resultStr = "<xml>" . $resultStr . $citys . "</xml>";
                    echo $resultStr;
                    exit();
                } elseif (strpos($contentResText, "活动") > 0) {
                    $city = str_replace("活动", "", $contentResText);
                    $citys = $this->getActive($city, "RS");
                    $citynum = $this->getActive($city, "NUM");
                    if ($citynum < 1) {
                        $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", "无法为你找到" . $city . "地区活动么,建议如浙江活动,杭州活动,想了解更多，请致电0573-83253333，陈经理");
                        echo $resultStr;
                        exit();
                    
                    }
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //获取最新的新闻资讯
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", $citynum);
                    $resultStr = "<xml>" . $resultStr . $citys . "</xml>";
                    echo $resultStr;
                    exit();
                } else {
                    $contentStr = "抱歉,你是在说:\"" . $contentResText . "\"么?";
                    $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", $contentStr);
                    echo $resultStr;
                    exit();
                
                }
            
            }
            
            //按钮为查询天气
            if ($keyword == "CXTQ") {
                $rs = $this->getUserInfo($fromUsername);
                $keyword = $rs['city'] . "天气";
            
            }
            
            if ($keyword == "YYJS") {
                $voiceTpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<Voice>
<MediaId><![CDATA[%s]]></MediaId>
</Voice>
</xml>";
                $rescontent = "6X6BuIiKeShxZ5h1_jdNSabfvvIIhLE-nWx2BReFFBcNe4dKS6h9mgOrxSNI4yp5";
                $resultStr = sprintf($voiceTpl, $fromUsername, $toUsername, $time, "voice", $rescontent);
                echo $resultStr;
                exit();
            }
            //文字输入
            if (strpos($keyword, "天气") > 0) {
                $city = str_replace("天气", "", $keyword);
                $contentStr = $this->getWeather($city);
                $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", $contentStr);
                echo $resultStr;
                exit();
            }
            //增加关键词提示
            switch ($keyword) {
             
                case "1" :
                    $rescontent = $this->mingyan();
                    break;
                case "2" :
                    $rescontent = "顶上集成吊顶,行业第一品牌,招商电话0573-83253333，联系人：陈经理";
                    break;
                case "5" :
                    $rescontent = "顶上集成吊顶欢迎你<a href=\"http://www.d-shang.com/news/i/?cid=1146\">点击进入</a>";
                    break;
                case "4" :
                    //每日抽奖
                    $rescontent = "顶上刮刮乐,<a href=\"http://www.d-shang.com/ggl/index/?openid=$fromUsername\">点击进入</a>";
                    break;
                case "HYHD" :
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //获取最新的新闻资讯
                    $newsItem = $this->getNews(1162, $this->topid, "HYHD", $fromUsername);
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 1);
                    $resultStr = "<xml>" . $resultStr . $newsItem . "</xml>";
                    echo $resultStr;
                    exit();
                    break;
                case "ZSJM" :
                    //招商加盟
                    $rescontent = $this->getNewsContent(33229);
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 1);
                    $newsFormat = "<Articles><item>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
<PicUrl><![CDATA[%s]]></PicUrl>
<Url><![CDATA[%s]]></Url>
</item>";
                    $newsItem = sprintf($newsFormat, "招商加盟", $rescontent['summary'], "http://www.d-shang.com" . $rescontent['pic'], "http://www.d-shang.com/news/v/?id=$rescontent[id]&mb=mm.tpl");
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //获取最新的新闻资讯
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 1);
                    $resultStr = "<xml>" . $resultStr . $newsItem . "</xml>";
                    echo $resultStr;
                    exit();
                    break;
                case "STORY" :
                    //品牌故事
                    $rescontent = $this->getNewsContent(33219);
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 1);
                    $newsFormat = "<Articles><item>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
<PicUrl><![CDATA[%s]]></PicUrl>
<Url><![CDATA[%s]]></Url>
</item>";
                    $newsItem = sprintf($newsFormat, "品牌故事", $rescontent['summary'], "http://www.d-shang.com" . $rescontent['pic'], "http://www.d-shang.com/news/v/?id=$rescontent[id]&mb=mm.tpl");
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //获取最新的新闻资讯
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 1);
                    $resultStr = "<xml>" . $resultStr . $newsItem . "</xml>";
                    echo $resultStr;
                    exit();
                    break;
                case "LXWM" :
                    $rescontent = "顶上集成吊顶,行业第一品牌,招商电话0573-83253333，联系人：陈经理";
                    break;
                case "10" :
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //微型故事
                    $newsItem = $this->getNews(1157, 33274);
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 5);
                    $resultStr = "<xml>" . $resultStr . $newsItem . "</xml>";
                    echo $resultStr;
                    exit();
                    break;
                case "11" :
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //生活百科
                    $newsItem = $this->getNews(1010, 33275);
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 5);
                    $resultStr = "<xml>" . $resultStr . $newsItem . "</xml>";
                    echo $resultStr;
                    exit();
                    break;
                case "9" :
                    $tpl = "<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<ArticleCount>%u</ArticleCount>";
                    //获取最新的新闻资讯
                    $newsItem = $this->getNews(2, $this->topid);
                    $resultStr = sprintf($tpl, $fromUsername, $toUsername, $time, "news", 5);
                    $resultStr = "<xml>" . $resultStr . $newsItem . "</xml>";
                    echo $resultStr;
                    exit();
                    break;
                default :
                    $rescontent = $this->help;
                    break;
            }
            $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, "text", $rescontent);
            echo $resultStr;
        } else {
            echo "";
            exit();
        }
    }
    
    /**
     * 增加投票会员
     * Enter description here ...
     */
    public function setVoteUser($username, $num, $sex, $address, $openid, $add_time)
    {
        $sql = "SELECT * FROM w_wx_user WHERE username='$username'";
        
        $rs = $this->db->get_one($sql);
        if (empty($rs)) {
            $sql2 = "INSERT INTO w_wx_user (username,num,sex,address,biaoji,add_time) VALUES ('$username','$num','$sex','$address','$openid',$add_time)";
            $this->db->query($sql2);
            $rs = array(
                    'username' => $username,
                    'num' => $num,
                    'sex' => $sex,
                    'openid' => $openid,
                    'address' => $address);
        }
        return $rs;
    }
    public function getNewsContent($contentid)
    {
        $sql = "SELECT * FROM w_news_list a LEFT JOIN w_news_content b ON a.id=b.nid WHERE a.id=$contentid";
        return $this->db->get_one($sql);
    }
    /**
     * RS NUM
     * Enter description here ...
     * @param unknown_type $city
     * @param unknown_type $type
     */
    public function getShop($city, $type = "RS")
    {
        $sql = "SELECT * FROM w_news_list WHERE cid=12 AND title like '%$city%' ORDER BY id DESC LIMIT 10";
        $query = $this->db->query($sql);
        
        $rs = $this->db->get_all($sql);
        if ($type == "NUM") {
            return count($rs);
        }
        $newsXML = "<Articles>";
        $format = "<item>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
<PicUrl><![CDATA[%s]]></PicUrl>
<Url><![CDATA[%s]]></Url>
</item>";
        $item = "";
        foreach ($rs as $v) {
            $item = sprintf($format, $v['title'], $v['summary'], "http://www.d-shang.com" . $v['thumb'], "http://www.d-shang.com/news/v/?id=$v[id]&mb=mm.tpl") . $item;
        
        }
        return $newsXML = $newsXML . $item . "</Articles>";
    
    }
    public function getActive($city, $type = "RS")
    {
        $sql = "SELECT * FROM w_extend_value WHERE `key`='address' AND `varchar` LIKE '%$city%' ORDER BY id DESC LIMIT 5";
        $extendrs = $this->db->get_all($sql);
        if (empty($extendrs)) {
            return false;
        }
        $gids = "";
        if ($type == "NUM") {
            return count($extendrs);
        }
        foreach ($extendrs as $v) {
            $gids = $gids . $v['gid'] . ",";
        }
        $gids = substr($gids, 0, strlen($gids) - 1);
        $sql2 = "SELECT * FROM w_news_list WHERE id  IN ($gids)";
        $rs = $this->db->get_all($sql2);
        $newsXML = "<Articles>";
        $format = "<item>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
<PicUrl><![CDATA[%s]]></PicUrl>
<Url><![CDATA[%s]]></Url>
</item>";
        $item = "";
        foreach ($rs as $v) {
            $item = sprintf($format, mb_substr($v['title'], 6, 50, "UTF8"), $v['summary'], "http://www.d-shang.com" . $v['thumb'], "http://www.d-shang.com/news/v/?id=$v[id]&mb=mm.tpl") . $item;
        
        }
        return $newsXML = $newsXML . $item . "</Articles>";
    }
    
    public function getNews($cid, $topId, $type = "NEWS", $openid = null)
    {
        $sql = "SELECT * FROM w_news_list WHERE cid=$cid ORDER BY id DESC LIMIT 4";
        $sql2 = "SELECT * FROM w_news_list WHERE id=$topId";
        $topnews = $this->db->get_one($sql2);
        $query = $this->db->query($sql);
        $rs = $this->db->get_all($sql);
        array_push($rs, $topnews);
        $newsXML = "<Articles>";
        $format = "<item>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
<PicUrl><![CDATA[%s]]></PicUrl>
<Url><![CDATA[%s]]></Url>
</item>";
        $item = "";
        foreach ($rs as $v) {
            if ($type == "HYHD") {
                $sql = "SELECT * FROM w_extend_value WHERE gid=$v[id] AND `key`='explicitLink'";
                $exrs = $this->db->get_one($sql);
                $link = $exrs['varchar'] . "/?openid=" . $openid;
            } else {
                $link = "http://www.d-shang.com/news/v/?id=$v[id]&mb=mm.tpl";
            
            }
            $item = sprintf($format, mb_substr($v['title'], 6, 50, "UTF8"), $v['summary'], "http://www.d-shang.com" . $v['thumb'], $link) . $item;
            $link = "";
        }
        return $newsXML = $newsXML . $item . "</Articles>";
    
    }
    
    //获取天气情况
    public function getWeather($city)
    {
        include "../lib/Weather.php";
        $getweather = new getweather();
        return $getweather->getw($city);
    
    }
    public function lxwm()
    {
    
    }
    /**
     * 返回回复模板
     * 0文本 1语音 2图片  3图文
     */
    protected function getTpl($num)
    {
        $tpl[0] = "<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[你好]]></Content>
</xml>";
        $tpl[1] = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[%s]]></MsgType>
<Voice>
<MediaId><![CDATA[%s]]></MediaId>
</Voice>
</xml>";
        
        $tpl[3] = "<xml>

</xml>";
        return $tpl[$num];
    }
    //获取accesstoken
    public function getAccessToken()
    {
        $accessUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxdd55b4acacd385a6&secret=5cd19ba4347af3fc34a2c7271c36f7f1";
        $content = file_get_contents($accessUrl);
        if (! $content) {
            return '爱油，抱歉，暂时没有取到用户信息,请稍后再试';
        }
        $rs = json_decode($content, true);
        return $rs['access_token'];
    }
    /**
     * 进行认证处理
     * Enter description here ...
     */
    private function checkSignature()
    {
        $signature = $_GET["signature"];
        $timestamp = $_GET["timestamp"];
        $nonce = $_GET["nonce"];
        $token = TOKEN;
        $tmpArr = array(
                $token,
                $timestamp,
                $nonce);
        sort($tmpArr);
        $tmpStr = implode($tmpArr);
        $tmpStr = sha1($tmpStr);
        if ($tmpStr == $signature) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * 获取微信用户信息
     * Enter description here ...
     */
    public function getUserInfo($openId)
    {
        $token = $this->token();
        $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $token . "&openid=$openId";
        $content = file_get_contents($url);
        if (! $content) {
            return '爱油，抱歉，暂时没有取到用户信息,请稍后再试';
        }
        return $rs = json_decode($content, true);
    
     //$string = $rs['nickname'] . $rs['sex'] . $rs['city'] . $rs['headimgurl'];
    //    return $string;
    }
    
    public function token()
    {
        $sql = "SELECT * FROM w_wx_config WHERE id=2";
        $query = $this->db->query($sql);
        $rs = $this->db->fetch_array($query);
        $currentTime = time();
        if ($currentTime - $rs['date'] < 7000) {
            return $rs['value'];
        }
        $newToken = $this->getAccessToken();
        
        $sql2 = "UPDATE w_wx_config SET value='$newToken',`date`='$currentTime' WHERE id=2";
        $this->db->query($sql2);
        return $newToken;
    
    }
    
    public function createMenu()
    {
        $token = $this->access_token;
    
     // return json_decode($menu);
    }
    
    /**
     * 获取名言
     * Enter description here ...
     */
    public function mingyan()
    {
        $num = rand(1, 8);
        $array = array(
                '不要灰心,继续努力，再来一次。',
                '激流勇进,屡败屡战，再来一次 。',
                '马步未稳,调整姿势,再来一次。',
                '开盖没奖，再来一次。',
                '会心一击，长矛顿挫，再来一次',
                '大喝一声,礼物吓跑，再来一次',
                '初出毛驴,有点激动,再来一次。',
                '来点金嗓子吧，再来一次',
                '运气不佳,烧香拜佛，再来一次');
        return $array[$num];
    }
}
?>